import time
from Public.MyTools import MyTools
from Page.Add import Add
from selenium import webdriver
from ddt import ddt,file_data
from Page.Login import Login
import unittest
@ddt
class TestCase(unittest.TestCase):
    def setUp(self):
        MyTools().log_set()
        self.driver = webdriver.Edge()
        self.driver.maximize_window()
    def tearDown(self):
        self.driver.quit()
    @file_data('../Data/cs.yaml')
    def test_ex_01(self,username,password):
        po = Login(self.driver)
        po.open_url('http://localhost:8080/login')
        po.username(username)
        po.password(password)
        po.login()
        time.sleep(3)
        po.sureloc()
        time.sleep(2)
        po.accept()
    def test_ex_02(self):
        po = Add(self.driver)
        po.open_url('http://localhost:8080')
        time.sleep(3)
        po.denglu()
        po.username()
        po.password()
        po.login()
        time.sleep(3)
        po.sureloc()
        time.sleep(2)
        po.accept()
        time.sleep(3)
        self.driver.refresh()
        po.add()
        time.sleep(3)
        po.fenlei()
        time.sleep(3)
        po.submit()

if __name__ == '__main__':
    unittest.main()


